<template>
	<view style="display: flex;" class="inforamtion">
		<view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">中标单位</view>
				<view class="rl">{{  filterMultiDictText(dictOptions['biddingUnit'], item.biddingUnit + '') }}</view>
			</view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">中标价(元)</view>
				<view class="rl">{{ item.bidding }}</view>
			</view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">付款方式</view>
				<view class="rl">{{ item.payType }}</view>
			</view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">税率(%)</view>
				<view class="rl">{{ item.taxRate }}</view>
			</view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">发票类型</view> 
				<view class="rl"> {{  filterMultiDictText(dictOptions['invoiceCategory'], item.invoiceCategory + '') }} </view>
			</view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">工期(供货期)</view>
				<view class="rl">{{ !item.duration?"":(item.duration.length>10?item.duration.substr(0,10):item.duration) }}</view>
			</view>
			<view class="option" style="width: 520rpx;">
				<view class="lf">是否垫资</view>
				<view class="rl">{{ filterMultiDictText(dictOptions['isAdvancePayment'], item.isAdvancePayment + '') }}</view>
			</view>
			
			<!-- <view class="option" style="width: 520rpx;">
				<view class="lf">价格执行有效期</view>
				<view class="rl">{{ filterMultiDictText(dictOptions['validity'], item.validity + '') }}</view>
			</view> -->
		</view>
		<view  style="flex: 1; display: flex; align-items: center; justify-content: flex-end;" v-if="!isShowBtn">
			<u-icon name="edit-pen-fill" color="#2979ff" size="20" @click="handleEidtForm(item)"></u-icon>
			<u-line  direction="col" length="20" margin="0 10rpx"></u-line>
			<u-icon name="trash-fill" color="red" size="20"  @click="handleRemoveForm(item)"></u-icon>
		</view>
	</view>
</template>

<script>
	import { filterMultiDictText, initDictOptions } from '@/utils/JDictSelectUtil.js'
export default {
  name: 'WinTheBidFormInfo',
  props: {
    index: {
      type: Number,
      default: null,
    },
    item: {
      type: Object,
      default: () => ({}),
    },
    teamId: {
      type: String,
      default: '',
    },
		// 是否展示按钮 false是展示true是不展示
		isShowBtn: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
			filterMultiDictText,
			initDictOptions,
			dictOptions: {},
    }
  },
	watch: {
		item: {
			handler (val) {
				if (val) {
					this.initDictConfig()
				}
			},
			immediate: true
		}
	},
  methods: {
		initDictConfig() {
			initDictOptions('erp_purchase_supplier,enterprise_name,id').then((res) => {
				if (res.success) {
					this.$set(this.dictOptions, 'biddingUnit', res.result)
				}
			})
			initDictOptions('invoice_type').then((res) => {
				if (res.success) {
					this.$set(this.dictOptions, 'invoiceCategory', res.result)
				}
			})
			initDictOptions('yes_no').then((res) => {
				if (res.success) {
					this.$set(this.dictOptions, 'isAdvancePayment', res.result)
				}
			})
			// initDictOptions('validity_type').then((res) => {
			// 	if (res.success) {
			// 		this.$set(this.dictOptions, 'validity', res.result)
			// 	}
			// })
		},
    handleCopyForm(item) {
      this.$emit('copy', [item, this.index])
    },
    handleEidtForm(item) {
      this.$emit('edit', [item, this.index])
    },
    handleRemoveForm(item) {
			uni.showModal({
				content: '确定删除吗？',
				success: res => {
					if (res.confirm) {
						this.$emit('remove', item)
					}
				}
			})
    },
  },
}
</script>

<style scoped lang="scss">
.inforamtion {
  margin-top: 10rpx;
  padding: 10rpx;
  border-radius: 15rpx;
  box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.1);
}
</style>
